home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / asm / alib11b.zip / CODE1.ZIP / DISKFILE / EXIST.ASM next >
Assembly Source File  |  1994-10-04  |  560b  |  22 lines

  1. ;----------------------------------------------------------------------------
  2. ;FILE_EXIST - determines if a file exists and can be opened
  3. ;
  4. ; inputs:    DS:[DX] pointing to ASCIIZ filename
  5. ; output:    if CF = 0, file exists
  6. ;            if CF = 1, AX = DOS error code
  7. ;* * * * * * * * * * * * * *
  8.     public    FILE_EXIST
  9. FILE_EXIST    PROC    FAR
  10.    push    bx
  11.    mov       ax,3d00h        ;open file at ds:dx
  12.    INT     21h
  13.    JB      FEX_EXIT
  14.    MOV     BX,AX
  15.    MOV       AH,3Eh        ;close file
  16.    INT     21h
  17. FEX_EXIT:
  18.    POP     BX
  19.    RETF
  20. FILE_EXIST    ENDP
  21.